-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "clean" hooks in non-umbrella apps and when override are presents #2863
Conversation
This patch currently breaks profile application with |
f06e116
to
2a7801b
Compare
huh, I think this fixed the application of single app hooks by properly assigning them in the top-level app in a non-umbrella project. See how the multi app filehas a single @tsloughter I think this is fixing things properly and we'll need to update the shelltests to accomodate this. |
As mentioned in erlang/rebar3#2863, fixing the `clean` hooks appears to have fixed their count by properly assigning them in the top-level app in a non-umbrella project. See how [the multi app file](https://github.com/tsloughter/rebar3_tests/blob/cba67afa851747bcdb5294c9d88c697f0d814b3c/multi_app_hooks/multi_app_hooks.test#L5) has a single `CLEAN!` hook but [the single app one had two for clean](https://github.com/tsloughter/rebar3_tests/blob/cba67afa851747bcdb5294c9d88c697f0d814b3c/single_app_hooks/single_app_hooks.test#L5-L6) while [having a single one for compile](https://github.com/tsloughter/rebar3_tests/blob/cba67afa851747bcdb5294c9d88c697f0d814b3c/single_app_hooks/single_app_hooks.test#L14). This is because the discovery step we weren't doing right before the PR meant that the hook was assigned both to the project and the individual app. By fixing the detection and overrides, the hook is properly assigned to the app in a single-app project, and to the project root when in an umbrella. This PR prepares tests to pass once the rebar3 one is merged.
Related PR: tsloughter/rebar3_tests#20 |
The issue appears to be that because the 'clean' operation might be run while dependencies have not yet been compiled, we applied a partial app detection mechanism with `rebar_app_disover:find_apps(..., ..., all, ...)`, which worked to parse "invalid" (unbuilt) apps, but also did not apply overrides. Instead, we trust the `install_deps` provider dependency by reusing the apps as they were fully parsed _if_ they were valid, and falling back to the `rebar_app_discover:find_apps/4` call only to cover the unreadable ones. This, it turns out, has the side effect of properly applying hooks when apps are fully parsed, and fixes erlang#2862 Note that we can only clean paths safely if the discovery steps for the apps is done with the right profile and options, which may also impact configurations and hooks. So rather than duplicating that, we invoke the 'as' provider. This also opens the door on choosing a different provider (such as 'app_discover' only) down the road if the -a option isn't given.
2a7801b
to
c4dce2d
Compare
The selection is a bit coarse right now (it's possible a specific app is not a dep but a top-level app), but we regardless keep basic cleaning as a simple discovery step to avoid installing deps there.
erlang/rebar3#2863 makes it so we stop scanning dependencies when cleaning only top-level apps.
tsloughter/rebar3_tests#21 is needed for this to pass. |
tsloughter/rebar3_tests#22 again :( |
Expand documentation with risks and status. Include a local rebar3 build to include erlang/rebar3#2863. Extend commands to use path environment variable to prevent erlang/otp header mismatch.
The issue appears to be that because the 'clean' operation might be run while dependencies have not yet been compiled, we applied a partial app detection mechanism with
rebar_app_disover:find_apps(..., ..., all, ...)
, which worked to parse "invalid" (unbuilt) apps, but also did not apply overrides.Instead, we trust the
install_deps
provider dependency by reusing the apps as they were fully parsed if they were valid, and falling back to therebar_app_discover:find_apps/4
call only to cover the unreadable ones.This, it turns out, has the side effect of properly applying hooks when apps are fully parsed, and fixes #2862
In turn, this change let me fix things up such that we no longer call
install_deps
when just callingrebar3 clean
-- we still need to call it when doing a broader clean (--apps
or--all
) but not when just calling it with no arguments.